package com.shaoshaohuo.app.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.shaoshaohuo.app.R;
import com.shaoshaohuo.app.db.DaoUtils;
import com.shaoshaohuo.app.entity.Lineinfo;
import com.shaoshaohuo.app.view.citymenu.entity.Area;

import java.util.List;

public class RunlineAdapter1<T> extends MyBaseAdapter<Lineinfo> {

	public RunlineAdapter1(Context ctx, List<Lineinfo> list, boolean flag) {
		super(ctx, list, flag);
	}

	@Override
	public View getView(int pos, View convertView, ViewGroup group) {

		ViewHolder holder;
		if (convertView == null) {
			convertView = View.inflate(context, R.layout.view_address_item, null);
			holder = new ViewHolder();
            holder.titleText = (TextView) convertView.findViewById(R.id.textview_address);
			// holder.timeText = (TextView)
			// convertView.findViewById(R.id.textview_time);
			// holder.contentText = (TextView)
			// convertView.findViewById(R.id.textview_amount);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}

		Lineinfo item = list.get(pos);
		Area fromCity = DaoUtils.findArea(item.getFromcityid());
		Area toCity = DaoUtils.findArea(item.getTocityid());
		holder.titleText.setText((fromCity == null ? "" : fromCity.getName()) + "  --  " + (toCity == null ? "" : toCity.getName()));
		
		holder.titleText.setCompoundDrawables(null, null, null, null);
		
		// holder.titleText.setText(msg.getBiddate());
		// holder.timeText.setText(msg.getUname());
		// holder.contentText.setText(msg.getBidmoney());

		return convertView;
	}

	static class ViewHolder {
		TextView titleText;
//		TextView timeText;
//		TextView contentText;
	}

}
